<?php
declare(strict_types=1);

namespace app\validate;

class UserWithdrawValidate extends BaseValidate
{
    protected $rule = [
        'withdraw_amount' => 'require|float|gt:0',
        'withdraw_name' => 'require|length:2,20',
        'withdraw_account' => 'require|length:5,50',
        'withdraw_account_type' => 'require|in:1,2,3,4' // 1支付宝 2微信 3银行卡 4企业账户
    ];

    protected $message = [
        'withdraw_amount.require' => '提现金额不能为空',
        'withdraw_amount.float' => '提现金额必须为数字',
        'withdraw_amount.gt' => '提现金额必须大于0',
        'withdraw_name.require' => '收款人姓名不能为空',
        'withdraw_name.length' => '收款人姓名长度必须在2-20个字符之间',
        'withdraw_account.require' => '收款账号不能为空',
        'withdraw_account.length' => '收款账号长度必须在5-50个字符之间',
        'withdraw_account_type.require' => '收款方式不能为空',
        'withdraw_account_type.in' => '收款方式不正确'
    ];

    // 申请提现场景
    public function sceneApply(): UserWithdrawValidate
    {
        return $this->only(['withdraw_amount', 'withdraw_name', 'withdraw_account', 'withdraw_account_type']);
    }
} 